package GUI;

import javax.swing.*;
import java.awt.*;

public class Example13 {
    public static void main(String[] args) {
        JFrame f=new JFrame("JFrame窗口");
        f.setSize(300,200);
        f.setLocation(300,200);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setLayout(new BorderLayout());
        JLabel label1=new JLabel();
        ImageIcon icon=new ImageIcon("FruitStore.jpg");
        Image img=icon.getImage();
        img=img.getScaledInstance(300,150,Image.SCALE_DEFAULT);
        icon.setImage(img);
        label1.setIcon(icon);
        JPanel panel = new JPanel();
        JLabel label2=new JLabel("欢迎进入水果超市",JLabel.CENTER);
        panel.add(label2);
        f.add(label1,BorderLayout.PAGE_START);
        f.add(panel,BorderLayout.PAGE_END);
        f.setVisible(true);
    }
}
